﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Yalie_SingleImport : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        DBOperator dbo = new DBOperator();

        string JH = jh_txt.Text;
        string JB = RadioButtonList1.SelectedValue;
        string CSLB = RadioButtonList2.SelectedValue ;
        string KGRQ = kgrq_txt.Text;
        string WGRQ = wgrq_txt.Text;
        string CSMC = DropDownList1.SelectedValue;
        string SGFS = sgfs_txt.Text;
        string CSCD = cscd_txt.Text;
        decimal SGJDDS1;
        decimal.TryParse(sgjdds1_txt.Text,out SGJDDS1);
        decimal SGJDDS2;
        decimal.TryParse(sgjdds2_txt.Text,out SGJDDS2);
        decimal CWSYHD;
        decimal.TryParse(syhd_txt.Text,out CWSYHD);
        decimal CWYXHD;
        decimal.TryParse(yxhd_txt.Text,out CWYXHD);
        int CH;
        int.TryParse(ch_txt.Text,out CH);
        string YLRQ = ylrq_txt.Text;
        string YLCS = ylcs_txt.Text;
        decimal PLYL;
        decimal.TryParse(plyl_txt.Text,out PLYL);
        decimal HSB;
        decimal.TryParse(hsb_txt.Text,out HSB);
        decimal JSL;
        decimal.TryParse(jsl_txt.Text,out JSL);
        string BZ = bz_txt.Text;

        YalieRecord ylr = new YalieRecord(JH, JB, CSLB, KGRQ, WGRQ, CSMC, SGFS, CSCD,BZ,SGJDDS1,SGJDDS2,CWSYHD,CWYXHD,CH,YLRQ,YLCS,PLYL,HSB,JSL);
        //单条记录录入数据库
        result_lbl.Text = dbo.SingleImport(ylr);
        //if (dbo.SingleImport(ylr))
        //{
        //    Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "<script>alert('单条数据录入成功!');</script>");
        //}
        //else
        //{
        //    Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "<script>alert('录入失败!数据库中已有该条记录！');</script>");
        //}
    }
}